/**
 *******************************************************************************
 * @file  tca9539.h
 * @brief This file contains all the functions prototypes of the TCA9539 driver
 *        library.
 @verbatim
   Change Logs:
   Date             Author          Notes
   2020-06-12       Zhangxl         First version
 @endverbatim
 *******************************************************************************
 * Copyright (C) 2020, Huada Semiconductor Co., Ltd. All rights reserved.
 *
 * This software component is licensed by HDSC under BSD 3-Clause license
 * (the "License"); You may not use this file except in compliance with the
 * License. You may obtain a copy of the License at:
 *                    opensource.org/licenses/BSD-3-Clause
 *
 *******************************************************************************
 */
#ifndef __TCA9539_H__
#define __TCA9539_H__

/* C binding of definitions if building with C++ compiler */
#ifdef __cplusplus
extern "C"
{
#endif

/*******************************************************************************
 * Include files
 ******************************************************************************/
#include "hc32_common.h"

/**
 * @addtogroup BSP
 * @{
 */

/**
 * @addtogroup Components
 * @{
 */

/** @addtogroup TCA9539
  * @{
  */

#if (BSP_TCA9539_ENABLE == BSP_ON)

/*******************************************************************************
 * Global type definitions ('typedef')
 ******************************************************************************/

/*******************************************************************************
 * Global pre-processor symbols/macros ('#define')
 ******************************************************************************/
/**
 * @defgroup TCA9539_Global_Macros TCA9539 Global Macros
 * @{
 */
#define TCA9539_REG_INPUT_0         ((uint8_t)0x00)
#define TCA9539_REG_INPUT_1         ((uint8_t)0x01)
#define TCA9539_REG_OUTPUT_0        ((uint8_t)0x02)
#define TCA9539_REG_OUTPUT_1        ((uint8_t)0x03)
#define TCA9539_REG_INVERT_0        ((uint8_t)0x04)
#define TCA9539_REG_INVERT_1        ((uint8_t)0x05)
#define TCA9539_REG_CONFIG_0        ((uint8_t)0x06)
#define TCA9539_REG_CONFIG_1        ((uint8_t)0x07)

/**
 * @}
 */

/*******************************************************************************
 * Global variable definitions ('extern')
 ******************************************************************************/

/*******************************************************************************
  Global function prototypes (definition in C source)
 ******************************************************************************/
/**
 * @defgroup TCA9539_Global_Functions TCA9539 Global Functions
 * @{
 */
void TCA9539_Init(void);
void TCA9539_IntInit(void);
void TCA9539_Reset(void);
void TCA9539_WriteReg(uint8_t u8Reg, uint8_t u8Val);
void TCA9539_ReadReg(uint8_t u8Reg, uint8_t *u8Val);

void EIO_Init(void);
void EIO_Reset(void);
void EIO_Delay(uint32_t u32Delay);
void EIO_Write(uint8_t u8Reg, uint8_t u8Val);
void EIO_Read(uint8_t u8Reg, uint8_t *u8Val);
void EIO_IntInit(void);

/**
 * @}
 */

#endif /* BSP_TCA9539_ENABLE */

/**
 * @}
 */

/**
 * @}
 */

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif /* __TCA9539_H__ */

/*******************************************************************************
 * EOF (not truncated)
 ******************************************************************************/
